<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/Timo" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body>
    <div class="timo-detail-page">
        <input type="hidden" id="versionId" th:value="${appVersion.id}">
        <div class="timo-detail-title">基本信息</div>
        <table class="layui-table timo-detail-table">
            <colgroup>
                <col width="100px"><col>
                <col width="100px"><col>
            </colgroup>
            <tbody>
                <tr>
                    <th>需求概述</th>
                    <td>
                        <pre th:text="${appVersion.demand_title}">需求概述</pre>
                    </td>
                    <th>需求URL</th>
                    <td th:text="${appVersion.demand_url}"></td>
                </tr>
                <tr>
                    <th>开发负责人</th>
                    <td>
                        <div th:replace="/common/fragment :: selectTag('leader_id',${users},${appVersion.leader_id},'id','nickname','disabled')"></div>
                    </td>
                    <th>开发成员</th>
                    <td th:text="${#entity.getUsernames(memberIds)}">
                        张三,李四
                    </td>
                </tr>
                <tr>
                    <th>项目开始时间</th>
                    <td colspan="3" th:text="${#dates.format(appVersion.start_time, 'yyyy-MM-dd')}"></td>
                </tr>
                <tr>
                    <th>版本名称</th>
                    <td colspan="3">
                        <span class="cliptxt" th:text="${appVersion.version}">test-branch</span>
                        &nbsp;&nbsp;&nbsp;
                        <button class="layui-btn js-clibtext" th:attr="data-clipboard-text=${appVersion?.hotfix_flag=='1'?'hotfix':'dev'}+'-'+${appVersion.version}">复制开发版本号</button>

                        <a class="layui-btn" data-type="radio" data-title="选择需要关联的应用项目"
                           th:href="@{/app/version/branch/combinepub(versionId=${appVersion.id})}" shiro:hasPermission="app:version:branch:combinepub">
                            <i class="fa fa-user-secret"></i> 获取上线资料
                        </a>
                    </td>
                </tr>
                <tr>
                    <th>任务类型</th>
                    <td th:style="${'color:'+(appVersion.hotfix_flag=='1'?'red':'green')}" th:text="${appVersion.hotfix_flag=='1'?'缺陷修复':'正常需求'}">
                        正常需求
                    </td>
                    <th>合并结果</th>
                    <td th:style="${'color:'+(hasConflict?'red':'green')}" th:text="${hasConflict?'有冲突':'正常'}"></td>
                </tr>
                <tr>
                    <th>是否已切发布分支</th>
                    <td>
                        <select mo:dict="APP_VERSION_CHECKOUT_STATUS" mo-selected="${appVersion.co_release_branch}" disabled="disabled"></select>
                    </td>
                    <th>发布状态</th>
                    <td>
                        <select class="timo-search-select layui-input" name="published" mo:dict="APP_VERSION_PUBLISHED" mo-selected="${appVersion.published}" disabled="disabled"></select>
                        <label th:if="${appVersion.published=='1'}">发布时间：<span th:text="${#dates.format(appVersion.publishtime,'yyyy-MM-dd HH:mm:ss')}">2021-06-02 12:00:01</span></label>
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="right">
                        <i class="layui-icon layui-icon-refresh refresh-btn"></i>
                        &nbsp;&nbsp;
                        <a th:if="${appVersion.published=='0'}" class="layui-btn open-popup" data-type="radio" data-title="选择需要关联的应用项目"
                           th:attr="data-url=@{/app/versionApp/allapps(versionId=${appVersion.id})}" shiro:hasPermission="app:versionApp:allapps"
                        data-size="800,500">
                            <i class="fa fa-user-secret"></i> 关联应用项目
                        </a>
                        <a th:if="${appVersion.published=='0' && appVersion.co_release_branch=='0' && appVersion.hotfix_flag=='0'}" class="layui-btn ajax-get" data-type="radio" data-msg="确定要创建发布分支"
                                th:href="@{/app/version/branch/newrelease(versionId=${appVersion.id})}" shiro:hasPermission="app:version:branch:newrelease">
                            <i class="fa fa-user-secret"></i> 创建发布分支
                        </a>

                        <a th:if="${appVersion.published=='0' && (appVersion.co_release_branch=='1' || appVersion.hotfix_flag=='1')}" class="layui-btn ajax-get" data-type="radio" data-msg="检测代码规范"
                                th:href="@{/app/version/branch/pmdcheck(versionId=${appVersion.id})}" shiro:hasPermission="app:version:branch:pmdcheck">
                            <i class="fa fa-user-secret"></i> 检测代码规范
                        </a>

                        <a th:if="${appVersion.published=='0' && hasConflict}" class="layui-btn ajax-status" data-type="radio" data-title="手动确认已合并"
                                th:href="@{/app/versionApp/branch/manualmerge(versionId=${appVersion.id})}" shiro:hasPermission="app:versionApp:branch:manualmerge">
                            <i class="fa fa-user-secret"></i> 手动已合并
                        </a>

                        <a th:if="${appVersion.published=='0' && appVersion.co_release_branch=='1' && appVersion.hotfix_flag=='0'}" class="layui-btn ajax-status" data-type="radio" data-title="dev合并到发布分支"
                                th:href="@{/app/versionApp/branch/merge2release(versionId=${appVersion.id})}" shiro:hasPermission="app:versionApp:branch:merge2release">
                            <i class="fa fa-user-secret"></i> dev合并到发布分支
                        </a>

                        <a th:if="${appVersion.published=='0'}" class="layui-btn ajax-get" data-type="radio" data-msg="一旦废弃，将无法再开启，除非从数据库层面打开（代码都保留），确定废弃该版本"
                           th:href="@{/app/version/discard(ids=${appVersion.id})}" shiro:hasPermission="app:version:status" style="background-color: #ff5722;">
                            <i class="fa fa-user-secret"></i> 废弃该版本
                        </a>
                        <a th:if="${appVersion.published=='0'}" class="layui-btn ajax-status" data-type="radio" data-title="确定将prod代码合并过来"
                           th:href="@{/app/versionApp/branch/mergefromprod(versionId=${appVersion.id})}" shiro:hasPermission="app:versionApp:branch:mergefromprod" style="background-color: #0bbe58;">
                            <i class="fa fa-user-secret"></i> 从prod合并
                        </a>

                        <a th:if="${appVersion.published=='0' && (appVersion.co_release_branch=='1' || appVersion.hotfix_flag=='1')}"  class="layui-btn ajax-status" data-type="radio" data-title="将项目api的jar包deploy到maven仓库，确保当前打包的项目依赖的api或项目都已经打包过了"
                           th:href="@{/app/versionApp/branch/deploy(versionId=${appVersion.id})}" shiro:hasPermission="app:versionApp:branch:deploy">
                            <i class="fa fa-user-secret"></i> deploy包
                        </a>

                        <a th:if="${appVersion.published=='0' && (appVersion.co_release_branch=='1' || appVersion.hotfix_flag=='1')}" class="layui-btn ajax-get" data-type="radio" data-msg="确定已发布上线？该操作会将发布分支合并到PROD，然后再将PROD合并到当前正在开发的所有分支，确认操作"
                           th:href="@{/app/version/published(versionId=${appVersion.id})}" shiro:hasPermission="app:version:published">
                            <i class="fa fa-user-secret"></i> 确定已上线
                        </a>

                        <a th:if="${canReopen}" class="layui-btn ajax-get" data-type="radio" data-msg="确认重开这个项目吗？"
                           th:href="@{/app/version/reopen(versionId=${appVersion.id})}" shiro:hasPermission="app:version:reopen">
                            <i class="fa fa-user-secret"></i> 重开项目
                        </a>
                    </td>
                </tr>
                <tr>
                    <td colspan="4" id="appList">
                        加载versionApp/index.html内容
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
<script th:replace="/common/template :: script"></script>
<script type="text/javascript" th:src="@{/js/plugins/jquery-2.2.4.min.js}"></script>
<script type="text/javascript" th:src="@{/js/plugins/clipboard.min.js}"></script>
<script type="text/javascript" th:src="@{/js/app/version/detail.js?v=1.6.11}"></script>
</body>
</html>